% \iffalse meta-comment
%
% Copyright 1994 the LaTeX3 project and the individual authors.
% All rights reserved. For further copyright information see the file
% legal.txt, and any other copyright indicated in this file.
% 
% This file is part of the LaTeX2e system.
% ----------------------------------------
% 
%  This system is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see bugs.txt.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
% \iffalse
%%% File: ltmath.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltmath.dtx}
             [1994/11/30 v1.0q LaTeX Kernel (Math Setup)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltmath.dtx}
\title{\filename}
\date{\filedate}
\author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Leslie Lamport\and
  Frank Mittelbach\and
  Chris Rowley\and
  Rainer Sch\"opf}
\begin{document}
   \maketitle
   \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
% \CheckSum{940}
%
% \section{Math setup}
%
% This file contains a lot of the original plain \TeX{} code, as well
% as the \LaTeX{} environments for math.
%
% \StopEventually{}
%
%    \begin{macrocode}
%<*2ekernel>
\message{math definitions,}
%    \end{macrocode}
%
%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%
% \subsection{Math commands based on plain \TeX}
%
% \subsubsection{The log-like functions}
%
% \changes{1.0m}{1994/10/29}{ASAJ: Added \cs{DeclareMathOperator}.}
% \changes{v1.0o}{1994/11/17}
%         {\cs{@tempa} to \cs{reserved@a}}
% \changes{1.0q}{1994/11/30}{ASAJ: \cs{DeclareMathOperator} moved to
%    AMS\LaTeX.}
%
% The standard operators:
%    \begin{macrocode}
\def\log{\mathop{\operator@font log}\nolimits}
\def\lg{\mathop{\operator@font lg}\nolimits}
\def\ln{\mathop{\operator@font ln}\nolimits}
\def\lim{\mathop{\operator@font lim}}
\def\limsup{\mathop{\operator@font lim\,sup}}
\def\liminf{\mathop{\operator@font lim\,inf}}
\def\sin{\mathop{\operator@font sin}\nolimits}
\def\arcsin{\mathop{\operator@font arcsin}\nolimits}
\def\sinh{\mathop{\operator@font sinh}\nolimits}
\def\cos{\mathop{\operator@font cos}\nolimits}
\def\arccos{\mathop{\operator@font arccos}\nolimits}
\def\cosh{\mathop{\operator@font cosh}\nolimits}
\def\tan{\mathop{\operator@font tan}\nolimits}
\def\arctan{\mathop{\operator@font arctan}\nolimits}
\def\tanh{\mathop{\operator@font tanh}\nolimits}
\def\cot{\mathop{\operator@font cot}\nolimits}
\def\coth{\mathop{\operator@font coth}\nolimits}
\def\sec{\mathop{\operator@font sec}\nolimits}
\def\csc{\mathop{\operator@font csc}\nolimits}
\def\max{\mathop{\operator@font max}}
\def\min{\mathop{\operator@font min}}
\def\sup{\mathop{\operator@font sup}}
\def\inf{\mathop{\operator@font inf}}
\def\arg{\mathop{\operator@font arg}\nolimits}
\def\ker{\mathop{\operator@font ker}\nolimits}
\def\dim{\mathop{\operator@font dim}\nolimits}
\def\hom{\mathop{\operator@font hom}\nolimits}
\def\det{\mathop{\operator@font det}}
\def\exp{\mathop{\operator@font exp}\nolimits}
\def\Pr{\mathop{\operator@font Pr}}
\def\gcd{\mathop{\operator@font gcd}}
\def\deg{\mathop{\operator@font deg}\nolimits}
%    \end{macrocode}
% And some operators have to be done by hand:
%    \begin{macrocode}
\def\bmod{\mskip-\medmuskip\mkern5mu
  \mathbin{\operator@font mod}\penalty900\mkern5mu\mskip-\medmuskip}
\def\pmod#1{\allowbreak\mkern18mu({\operator@font mod}\,\,#1)}
%    \end{macrocode}
%
% \subsubsection{Biggggg}
%
% Variants on |\big| and friends for use with delimiters:
%    \begin{macrocode}
\def\bigl{\mathopen\big}
\def\bigm{\mathrel\big}
\def\bigr{\mathclose\big}
\def\Bigl{\mathopen\Big}
\def\Bigm{\mathrel\Big}
\def\Bigr{\mathclose\Big}
\def\biggl{\mathopen\bigg}
\def\biggm{\mathrel\bigg}
\def\biggr{\mathclose\bigg}
\def\Biggl{\mathopen\Bigg}
\def\Biggm{\mathrel\Bigg}
\def\Biggr{\mathclose\Bigg}
%    \end{macrocode}
%
% \subsubsection{The UNSORTED Rest}
%
% The other math commands are lifted from plain \TeX.
%
%    \begin{macrocode}
\newdimen\jot \jot=3pt
\newcount\interdisplaylinepenalty \interdisplaylinepenalty=100
%    \end{macrocode}
% 
%    \begin{macrocode}
\def\choose{\atopwithdelims()}
\def\brack{\atopwithdelims[]}
\def\brace{\atopwithdelims\{\}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\mathpalette#1#2{\mathchoice{#1\displaystyle{#2}}%
  {#1\textstyle{#2}}{#1\scriptstyle{#2}}{#1\scriptscriptstyle{#2}}}
\newbox\rootbox
\def\root#1\of{\setbox\rootbox\hbox{$\m@th\scriptscriptstyle{#1}$}
  \mathpalette\r@@t}
\def\r@@t#1#2{\setbox\z@\hbox{$\m@th#1\sqrt{#2}$}
  \dimen@\ht\z@ \advance\dimen@-\dp\z@
  \mkern5mu\raise.6\dimen@\copy\rootbox \mkern-10mu \box\z@}
%    \end{macrocode}
%
% \begin{macro}{\phantom}
% \changes{v1.0p}{1994/11/18}
%         {(DPC) use \cs{expandafter} instead of \cs{next}}
% \changes{v1.0p}{1994/11/18}
%         {(DPC) colour support}
% \begin{macro}{\mathstrut}
%    \begin{macrocode}
\newif\ifv@ \newif\ifh@
\def\vphantom{\v@true\h@false\ph@nt}
\def\hphantom{\v@false\h@true\ph@nt}
\def\phantom{\v@true\h@true\ph@nt}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\ph@nt{%
  \ifmmode
    \expandafter\mathpalette\expandafter\mathph@nt
  \else
    \expandafter\makeph@nt
  \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\makeph@nt#1{%
  \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finph@nt}
\def\mathph@nt#1#2{%
  \setbox\z@\hbox{$\m@th#1{#2}$}\finph@nt}
\def\finph@nt{%
  \setbox\tw@\null
  \ifv@ \ht\tw@\ht\z@ \dp\tw@\dp\z@\fi
  \ifh@ \wd\tw@\wd\z@\fi \box\tw@}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\mathstrut{\vphantom(}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\smash}
% \changes{v1.0p}{1994/11/18}
%         {(DPC) use \cs{expandafter} instead of \cs{next}}
% \changes{v1.0p}{1994/11/18}
%         {(DPC) colour support}
%    \begin{macrocode}
\def\smash{%
  \relax % \relax, in case this comes first in \halign
  \ifmmode
    \expandafter\mathpalette\expandafter\mathsm@sh
  \else
    \expandafter\makesm@sh
  \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\makesm@sh#1{%
  \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finsm@sh}
\def\mathsm@sh#1#2{%
  \setbox\z@\hbox{$\m@th#1{#2}$}\finsm@sh}
\def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \box\z@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\buildrel}
%    \begin{macrocode}
\def\buildrel#1\over#2{\mathrel{\mathop{\kern\z@#2}\limits^{#1}}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\cases}
% \changes{LaTeX2.09}{1991/08/14}
%         {(RmS) inserted extra braces around entry for NFSS}
%    \begin{macrocode}
\def\cases#1{\left\{\,\vcenter{\normalbaselines\m@th
    \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\right.}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\def\matrix#1{\null\,\vcenter{\normalbaselines\m@th
    \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
      \mathstrut\crcr\noalign{\kern-\baselineskip}
      #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
\def\pmatrix#1{\left(\matrix{#1}\right)}
%    \end{macrocode}
%
%
% \begin{macro}{\bordermatrix}
% \changes{LaTeX2e}{1994/01/25}{Removed \cmd{\p@renwd}.}
%    \begin{macrocode}
\def\bordermatrix#1{\begingroup \m@th
  \@tempdima 8.75\p@
  \setbox\z@\vbox{%
    \def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
    \ialign{$##$\hfil\kern2\p@\kern\@tempdima&\thinspace\hfil$##$\hfil
      &&\quad\hfil$##$\hfil\crcr
      \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
      #1\crcr\omit\strut\cr}}%
  \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{$\kern\wd\@ne\kern-\@tempdima\left(\kern-\wd\@ne
    \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
    \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right)$}%
  \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\def\openup{\afterassignment\@penup\dimen@=}
\def\@penup{\advance\lineskip\dimen@
  \advance\baselineskip\dimen@
  \advance\lineskiplimit\dimen@}
%    \end{macrocode}
%
%    \begin{macrocode}
\newif\ifdt@p
\def\displ@y{\global\dt@ptrue\openup\jot\m@th
  \everycr{\noalign{\ifdt@p \global\dt@pfalse
      \vskip-\lineskiplimit \vskip\normallineskiplimit
      \else \penalty\interdisplaylinepenalty \fi}}}
\def\@lign{\tabskip\z@skip\everycr{}} % restore inside \displ@y
\def\displaylines#1{\displ@y
  \halign{\hbox to\displaywidth{$\@lign\hfil\displaystyle##\hfil$}\crcr
    #1\crcr}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\mathhexbox#1#2#3{\leavevmode
  \hbox{$\m@th \mathchar"#1#2#3$}}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\sp=^ \let\sb=_
%\def\,{\mskip\thinmuskip}      % already defined in ltspace
\def\>{\mskip\medmuskip}
\def\;{\mskip\thickmuskip}
\def\!{\mskip-\thinmuskip}
\def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
%    \end{macrocode}
%
% \begin{macro}{\prime@s}
% \changes{v1.0p}{1994/11/18}
%         {(DPC) use \cs{@let@token} instead of \cs{next}
%           and \cs{expandafter} instead of \cs{nxt}}
%    \begin{macrocode}
{\catcode`\'=\active \gdef'{^\bgroup\prim@s}}
\def\prim@s{%
  \prime\futurelet\@let@token\pr@m@s}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\pr@m@s{%
  \ifx'\@let@token
    \expandafter\pr@@@s
  \else
    \ifx^\@let@token
      \expandafter\expandafter\expandafter\pr@@@t
    \else
      \egroup
    \fi
  \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\pr@@@s#1{\prim@s} \def\pr@@@t#1#2{#2\egroup}
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.0i}{1994/05/17}{Replaced \cs{let} by \cs{gdef}, for
%            indirect definition.}
%    \begin{macrocode}
{\catcode`\_=\active \gdef_{\_}} % _ in math is
                                 % either subscript or \_
%    \end{macrocode}
%
%
% \changes{v1.0m}{1994/10/29}{ASAJ: Removed \cs{dag}, \cs{ddag}.}
% \changes{v1.0m}{1994/10/29}{ASAJ: Renamed \cs{S} and \cs{P} to 
%    \cs{mathsection} and \cs{mathparagraph} and made them 
%    \cs{mathchardef}s.} 
% \changes{v1.0m}{1994/10/29}{ASAJ: Added \cs{mathellipsis}, 
%    \cs{mathdollar} and \cs{mathsterling}.}
% \changes{v1.0n}{1994/10/30}{ASAJ: Moved the new commands to ltoutenc.}
%
% \subsection{Math Environments}
%
% \changes{1.0m}{1994/10/29}{ASAJ: Tidied up documentation.}
%
% \begin{macro}{\(}
% \begin{macro}{\)}
%    Produces |$...$| with checks that |\(| isn't used in math mode, and
%    that |\)| is only used in math mode begun with |\(|.
%    \begin{macrocode}
\def\({\relax\ifmmode\@badmath\else$\fi}
\def\){\relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\[}
% \begin{macro}{\]}
%    Produces |$$...$$| with checks that |\[| isn't used in math mode, 
%    and that |\]| is only used in math mode begun with |\]|.
%    \begin{macrocode}
\def\[{%
   \relax\ifmmode
      \@badmath
   \else
      \ifvmode
         \nointerlineskip 
         \makebox[.6\linewidth]%
      \fi
      $$%%$$ BRACE MATCH HACK
   \fi
}
\def\]{%
   \relax\ifmmode
      \ifinner
         \@badmath
      \else
         $$%%$$ BRACE MATCH HACK
      \fi
   \else
      \@badmath 
   \fi
   \ignorespaces
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{environment}{math}
% \begin{environment}{displaymath}
%    Disguises for |\(...\)| and |\[...\]|.
%    \begin{macrocode}
\let\math=\(
\let\endmath=\)
\def\displaymath{\[}
\def\enddisplaymath{\]\global\@ignoretrue}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% \changes{LaTeX2.09}{92/01/10}{RmS: put \cs{hbox} around \cs{@eqnnum} 
%    to typeset the equation number in text mode 
%    (as in the eqnarray env.)}
%
% \begin{environment}{equation}
% \begin{macro}{\c@equation}
%  Numbered equations, using the counter |\c@equation|.
%  \emph{Note}: The document style must define |\theequation| etc., and
%  do the appropriate |\@addtoreset|. It should also redefine |\@eqnnum|
%  if another format for the equation number is desired other than the
%  standard (...), or to move the equation numbers to the flushleft.
%   (See comment on the |\def| of |\@eqnnum|.)
%    \begin{macrocode}
\@definecounter{equation}
\def\equation{$$\refstepcounter{equation}}
\def\endequation{\eqno \hbox{\@eqnnum}$$\global\@ignoretrue}
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% \changes{LaTeX2.09}{91/09/29}{RmS: \cs{reset@font} added.}
% \changes{v1.0l}{1994/10/23}{Added \cs{normalcolor} since \cs{eqno}
%    introduces a subgroup of the displayed math group}
%
% \begin{macro}{\@eqnnum}
%     Produces the equation number for equation and
%     eqnarray environments.  The following definition is for
%     flushright numbers; for flushleft numbers, see leqno.clo.
%     The equation number is set in black roman type even
%     if an eqnarray environment appears in an italic environment.
%    \begin{macrocode}
\def\@eqnnum{{\reset@font\rmfamily \normalcolor (\theequation)}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\stackrel}
%    A disguise for plain \TeX's buildrel.
%    \begin{macrocode}
\def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}}
%    \end{macrocode}
% \end{macro}
%
%  \changes{v0.9g}{1993/12/11}{Added a group around the first argument
%    of \cs{frac} to prevent
%    changes (for example font changes) from modifying the contents of
%     the second argument.}
%
%  \begin{macro}{\frac}
%    A disguise for plain \TeX's |\over|.
%    \begin{macrocode}
\def\frac#1#2{{\begingroup#1\endgroup\over#2}}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\sqrt}
% \begin{macro}{\@sqrt}
% \begin{macro}{\@@sqrt}
%    Add an optional argument to plain's |\sqrt| to give the $n$th root 
%    of an expression $\sqrt[n]{e}$.
%    \begin{macrocode}
\let\@@sqrt=\sqrt
\def\sqrt{\@ifnextchar[\@sqrt\@@sqrt}
\def\@sqrt[#1]{\root #1\of}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\:}
%    A medium space.
%    \begin{macrocode}
\let\:=\>
%    \end{macrocode}
% \end{macro}
%
% \changes{LaTeX2.09}{1985/11/04}{produce warning message if line
%      extends into margin.  Doesn't warn about formula
%      overprinting equation number.}
% \changes{LaTeX2.09}{1993/11/02}{RmS: 
%        Corrected description of \cs{@eqnsel}, moved \cs{@eqnsel}
%        accordingly and removed extra \cs{tabskip} assignment.}
% \changes{LaTeX2e}{1993/11/03}{RmS: Initialized \cs{everycr} to empty}
% \changes{v0.9i}{1993/12/16}
%     {use \cs{refstepcounter} instead of shortcut}
% \changes{v0.9o}{1994/01/13}{correcting 0.9i}
%
% \begin{environment}{eqnarray}
% \begin{macro}{\@eqcnt}
% \begin{macro}{\@eqpen}
% \begin{macro}{\if@eqnsw}
% \begin{macro}{\@eqnsel}
%    Here's the eqnarray environment:
%    Default is for left-hand side of equations to be flushright.
%    To make them flushleft, |\let\@eqnsel = \hfil|.
%    \begin{macrocode}
\newcount\@eqcnt
\newcount\@eqpen
\newif\if@eqnsw\@eqnswtrue
\@centering = 0pt plus 1000pt
%    \end{macrocode}
%    To get a proper \cs{@currentlabel} we have to redefine it for the
%    whole display. Note that we can't use \cs{refstepcounter} as this
%    results in |\@currentlabel| getting restored at the wrong and
%    thus always writing the first label to the \texttt{.aux} file.
%    \begin{macrocode}
\def\eqnarray{%
   \stepcounter{equation}%
   \def\@currentlabel{\p@equation\theequation}%
   \global\@eqnswtrue
   \m@th
   \global\@eqcnt\z@
   \tabskip\@centering
   \let\\\@eqncr
   $$\everycr{}\halign to\displaywidth\bgroup
       \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
      &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
      &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep 
         $\displaystyle{##}$\hfil\tabskip\@centering
      &\global\@eqcnt\thr@@ \hbox to\z@\bgroup\hss##\egroup
         \tabskip\z@skip
      \cr
}
\def\endeqnarray{%
      \@@eqncr
      \egroup
      \global\advance\c@equation\m@ne
   $$\global\@ignoretrue
}
\let\@eqnsel=\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\nonumber}
%    Switches off equation numbering.
%    \begin{macrocode}
\def\nonumber{\global\@eqnswfalse}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\@eqncr}
% \begin{macro}{\@xeqncr}
% \begin{macro}{\@yeqncr}
%    \begin{macrocode}
\def\@eqncr{%
   {\ifnum0=`}\fi
   \@ifstar{%
      \global\@eqpen\@M\@yeqncr
   }{%
      \global\@eqpen\interdisplaylinepenalty \@yeqncr
   }%
}
\def\@yeqncr{%
   \@ifnextchar [%
      \@xeqncr
      {\@xeqncr[\z@skip]}%
}
\def\@xeqncr[#1]{%
   \ifnum0=`{\fi}%
   \@@eqncr
   \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}%
}
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
%
%  \begin{macro}{\@@eqncr}
% \changes{v0.9i}{1993/12/16}{use `refstepcounter instead of shortcut}
% \changes{v0.9o}{1994/01/13}{correcting 0.9i}
%
%    \begin{macrocode}
\def\@@eqncr{\let\reserved@a\relax
    \ifcase\@eqcnt \def\reserved@a{& & &}\or \def\reserved@a{& &}%
     \or \def\reserved@a{&}\else
       \let\reserved@a\@empty
       \@latex@error{Too many columns in eqnarray environment}\@ehc\fi
     \reserved@a \if@eqnsw\@eqnnum\stepcounter{equation}\fi
     \global\@eqnswtrue\global\@eqcnt\z@\cr}
%    \end{macrocode}
%  \end{macro}
%
% \begin{environment}{eqnarray*}
% \begin{macro}{\@seqncr}
%    Here's the eqnarray* environment:
%    \begin{macrocode}
\let\@seqncr=\@eqncr
\@namedef{eqnarray*}{\def\@eqncr{\nonumber\@seqncr}\eqnarray}
\@namedef{endeqnarray*}{\nonumber\endeqnarray}
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\lefteqn}
%  |\lefteqn{FORMULA}| typesets |FORMULA| in display math style
%  flushleft in a box of width zero.
%    \begin{macrocode}
\def\lefteqn#1{\hbox to\z@{$\displaystyle #1$\hss}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ensuremath}
%   In math mode, |\ensuremath{text}| is equivalent to text; in LR or
%   paragraph mode, it is equivalent to |$|text|$|. 
%   |\relax| is not needed
%   in front of the |\ifmmode| as |\protect| will be |\let| to |\relax|.
% \changes{v1.0k}{1994/05/16}
%     {Use \cs{DeclareRobustCommand} and add extra braces in math mode}
% \changes{v1.0l}{1994/10/23}{Remove extra braces: but see p 168 of
%      Leslie's book}
%    \begin{macrocode}
\DeclareRobustCommand\ensuremath[1]{\ifmmode #1\else $#1$\fi}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
% \Finale
%
